var api = 'http://172.16.3.60:8080/';
$("#logins").bind('click', function () {
    if ($("#u").val() !== '' && $("#p").val() !== '') {
        jQuery.support.cors = true;
        $.ajax({
            type: 'post',
            url: api + 'bfm-admin/loginSystem',
            contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
            xhrFields: {
                withCredentials: true
            },
            dataType: 'json',
            data: {
                loginName: $('#u').val(),
                passWord: $('#p').val(),
                date: new Date()
            },
            success: function (res) {
                if (res.success) {
                    $.cookie('hxcookies', $('#u').val());
                    ds.dialog({
                        title: '消息提示',
                        content: '登录成功',
                        timeout: 2
                    });
                    setTimeout(function () {
                        window.location.href = 'index.html';
                    }, 200)
                }
                else {
                    ds.dialog({
                        title: '消息提示',
                        content: res.errMsg,
                        timeout: 3
                    });
                }
            },
            error: function (res) {
                console.log('error')
            }
        })

    }
    else {
        ds.dialog({
            title: '消息提示',
            content: '请填写完再点击登录！',
            timeout: 3
        });
    }
});